package com.spic.business.datamanagement.meetingbefore.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.spic.business.informatization.before_after_work.mapper.MeetingBeforeAfterMapper;
import com.spic.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spic.business.datamanagement.meetingbefore.mapper.MeetingBeforeAfterDirtyMapper;
import com.spic.business.datamanagement.meetingbefore.domain.MeetingBeforeAfterDirty;
import com.spic.business.datamanagement.meetingbefore.service.IMeetingBeforeAfterDirtyService;

/**
 * 班前班后会主Service业务层处理
 * 
 * @author 赵祥
 * @date 2022-11-26
 */
@Service
public class MeetingBeforeAfterDirtyServiceImpl implements IMeetingBeforeAfterDirtyService 
{
    @Autowired
    private MeetingBeforeAfterDirtyMapper meetingBeforeAfterDirtyMapper;
    @Autowired
    private MeetingBeforeAfterMapper meetingBeforeAfterMapper;

    /**
     * 查询班前班后会主
     * 
     * @param id 班前班后会主主键
     * @return 班前班后会主
     */
    @Override
    public MeetingBeforeAfterDirty selectMeetingBeforeAfterDirtyById(String id)
    {
        return meetingBeforeAfterDirtyMapper.selectMeetingBeforeAfterDirtyById(id);
    }

    /**
     * 查询班前班后会主列表
     * 
     * @param meetingBeforeAfterDirty 班前班后会主
     * @return 班前班后会主
     */
    @Override
    public List<MeetingBeforeAfterDirty> selectMeetingBeforeAfterDirtyList(MeetingBeforeAfterDirty meetingBeforeAfterDirty)
    {
        return meetingBeforeAfterDirtyMapper.selectMeetingBeforeAfterDirtyList(meetingBeforeAfterDirty);
    }

    /**
     * 新增班前班后会主
     * 
     * @param meetingBeforeAfterDirty 班前班后会主
     * @return 结果
     */
    @Override
    public int insertMeetingBeforeAfterDirty(MeetingBeforeAfterDirty meetingBeforeAfterDirty)
    {
        meetingBeforeAfterDirty.setCreateTime(DateUtils.getNowDate());
        return meetingBeforeAfterDirtyMapper.insertMeetingBeforeAfterDirty(meetingBeforeAfterDirty);
    }

    /**
     * 修改班前班后会主
     * 
     * @param meetingBeforeAfterDirty 班前班后会主
     * @return 结果
     */
    @Override
    public int updateMeetingBeforeAfterDirty(MeetingBeforeAfterDirty meetingBeforeAfterDirty)
    {
        meetingBeforeAfterDirty.setUpdateTime(DateUtils.getNowDate());
        return meetingBeforeAfterDirtyMapper.updateMeetingBeforeAfterDirty(meetingBeforeAfterDirty);
    }

    /**
     * 批量删除班前班后会主
     * 
     * @param ids 需要删除的班前班后会主主键
     * @return 结果
     */
    @Override
    public int deleteMeetingBeforeAfterDirtyByIds(String[] ids)
    {
        return meetingBeforeAfterDirtyMapper.deleteMeetingBeforeAfterDirtyByIds(ids);
    }

    /**
     * 删除班前班后会主信息
     * 
     * @param id 班前班后会主主键
     * @return 结果
     */
    @Override
    public int deleteMeetingBeforeAfterDirtyById(String id)
    {
        return meetingBeforeAfterDirtyMapper.deleteMeetingBeforeAfterDirtyById(id);
    }

    @Override
    public Map<String, Integer> statistics() {
        Integer all = 0, allDirty = 0, incomplete = 0, incorrect = 0;
        all = meetingBeforeAfterMapper.selectCount(new QueryWrapper<>());
        allDirty = meetingBeforeAfterDirtyMapper.selectCount(new QueryWrapper<>());
        Map<String, Integer> map = new HashMap<>();
        map.put("all", all);
        map.put("allDirty", allDirty);
        map.put("incomplete", incomplete);
        map.put("incorrect", allDirty);
        return map;
    }
}
